# -*- coding: utf-8 -*-
from tkGrid import *
import xmlrpclib
#import pickle
import tkMessageBox as msgBox
try:
    from xTkinter import *
except:
    print >> sys.stderr, 'Le module xTkinter est  introuvable'  
    sys.exit(1)
import sys

class Vue_ReglesAffaires(Frame):
    def __init__(self, master,parent,**cnf):
        KeysList=cnf.keys()
        self.parent = parent
        self.master=master
        self.width=400
        self.height=200
        if ('width' in KeysList):
            self.width=cnf['width']
        if ('width' in KeysList):
            self.height=cnf['height']
        Frame.__init__(self,master,cnf)        
        self.config(bg='#6B979C',relief='raised',bd=3)
        self.pack(side=LEFT, anchor=NW)
        self.configure(width=786,height=381)
        
        # CREATION DU GUI RÈGLES D'AFFAIRES
        self.Regles_Affaires=xLabel(self,text='Règles d''affaires',height=1,width=14)
        self.Regles_Affaires_Label.place(x=10,y=40)
        self.Regles_Affaires=xCombobox(self,width=30)
        
        self.Condition_Combo_Box=xCombobox(self,width=8)
        self.Condition_Combo_Box.place(x=10,y=175)
        self.Condition_Label=xLabel(self,text='Condition',height=1,width=8)
        self.Condition_Label.place(x=10,y=150)
        
        self.Table_Operande_Gauche=xCombobox(self,width=20)
        self.Table_Operande_Gauche.place(x=65,y=175)
        self.Table1_Label=xLabel(self,text='Opérande',height=1,width=20)
        self.Table1_Label.place(x=65,y=150)
        
        self.Attribut1_Label=xLabel(self,text='Attribut',height=1,width=20)
        self.Attribut1_Label.place(x=195,y=150)
        self.Attribut_Operande_Droite=xCombobox(self,width=20)
        self.Attribut_Operande_Droite.place(x=195,y=175)
        
        self.Comparaison_Label=xLabel(self,text='Comparaison',height=1,width=10)
        self.Comparaison_Label.place(x=320,y=150)
        self.Comparaison_Combo_Box=xCombobox(self,width=10)
        self.Comparaison_Combo_Box.place(x=320,y=175)
        
        self.Table_Operande_Droite=xCombobox(self,width=25)
        self.Table_Operande_Droite.place(x=390,y=175)
        self.Table2_Label=xLabel(self,text='Opérande',height=1,width=20)
        self.Table2_Label.place(x=390,y=150)
        
        self.Attribut2_Label=xLabel(self,text='Attribut',height=1,width=20)
        self.Attribut2_Label.place(x=550,y=150)
        self.Attribut_Operande_Droite=xCombobox(self,text='Attribut',height=1,width=20)
        self.Attribut_Operande_Droite.place(x=550,y=175)
        
        self.Operande_Droite_Label=xLabel(self,text='Opérande',height=1,width=20)
        self.Operande_Droite_Label.place(x=490,y=125)
        self.Operande_Gauche_Label=xLabel(self,text='Opérande',height=1,width=20)
        self.Operande_Gauche_Label.place(x=145,y=125)
        
        self.Regles_Affaires=xLabel(self,text='Règles d''affaires',height=1,width=14)
        self.Regles_Affaires_Label.place(x=10,y=40)
        self.Regles_Affaires=xCombobox(self,width=30)
        self.Regles_Affaires.place(x=100,y=40)
        
        self.Conseils_Label=xLabel(self,text='Conseils',height=1,width=10)
        self.Conseils_Label.place(x=195,y=305)
        self.Conseils_Text=xText(self,text='Conseils',height=1,width=50)
        self.Conseils_Text.place(x=265,y=305)
        
        self.Message_Erreur_Text=xText(self,text='Message d''erreur',height=1,width=50)
        self.Message_Erreur_Text.place(x=265,y=265)
        self.Message_Erreur_Label=xLabel(self,text='Message d''erreur',height=1,width=20)
        self.Message_Erreur_Label.place(x=135,y=265)
        
        self.Creer_Button=xButton(self,text='Créer',height=1,width=10)
        self.Creer_Button.place(x=325,y=40)
        
        self.Sauvegarder_Button=xButton(self,text='Sauvegarder',height=1,width=10)
        self.Sauvegarder_Button.place(x=325,y=70)
        
        self.Quitter_Button=xButton(self,text='Quitter',height=1,width=10)
        self.Quitter_Button.place(x=620,y=300)
        
        self.Supprimer_Button=xButton(self,text='Supprimer',height=1,width=10)
        self.Supprimer_Button.place(x=450,y=70)
        
        self.Annuler_Button=xButton(self,text='Annuler',height=1,width=10)
        self.Annuler_Button.place(x=620,y=260)
        
        self.place(x=0,y=0)
        pass
    
    def Quitter(self):
        #if MsgBox.askokcancel("Attention", "Vous annulez l'ouverture de session."):
        self.destroy()
        pass
    
    def close(self):
        self.destroy()
        pass
